home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / helicopter_alien_scripts.lua < prev    next >
Encoding:
Text File  |  2009-04-28  |  7.5 KB  |  191 lines

  1.  
  2. function units_helicopter_alien_setup()
  3.     units_setup(2,true,ENET_EFFECT_PS_SETUPSMOKE_MEDIUM,ENET_EFFECT_GEOMETRY_HELICOPTERALIENSHADOW,true)
  4.     local unit = uniGetExecutor()
  5.     unit:getBone(ENBT_FAN,0):addRotationEffect(ENET_EFFECT_ROTATE_RADAR,MATH_PI / 2)
  6.     unit:getBone(ENBT_FAN,1):addRotationEffect(ENET_EFFECT_ROTATE_RADAR,MATH_PI / 2)
  7.     unit:getBone(ENBT_FAN,0):addSimpleEffect(ENET_EFFECT_BINDEDSPRITE_HELICOPTERALIENPROPELLER2)
  8.     unit:getBone(ENBT_FAN,1):addSimpleEffect(ENET_EFFECT_BINDEDSPRITE_HELICOPTERALIENPROPELLER)
  9.     unit:addSimpleEffect(ENET_EFFECTEMITTER_HELICOPTERWATERWAVES)
  10.     unit:addSimpleEffect(ENET_EFFECT_HELICOPTER_WATERWAVES2)
  11. end
  12.  
  13. function units_helicopter_alien_resetup()
  14.     units_setup(2,true,nil,ENET_EFFECT_GEOMETRY_HELICOPTERALIENSHADOW,true)
  15.     local unit = uniGetExecutor()
  16.     unit:getBone(ENBT_FAN,0):addRotationEffect(ENET_EFFECT_ROTATE_RADAR,MATH_PI / 2)
  17.     unit:getBone(ENBT_FAN,1):addRotationEffect(ENET_EFFECT_ROTATE_RADAR,MATH_PI / 2)
  18.     unit:getBone(ENBT_FAN,0):addSimpleEffect(ENET_EFFECT_BINDEDSPRITE_HELICOPTERALIENPROPELLER2)
  19.     unit:getBone(ENBT_FAN,1):addSimpleEffect(ENET_EFFECT_BINDEDSPRITE_HELICOPTERALIENPROPELLER)
  20.     unit:addSimpleEffect(ENET_EFFECTEMITTER_HELICOPTERWATERWAVES)
  21.     unit:addSimpleEffect(ENET_EFFECT_HELICOPTER_WATERWAVES2)
  22. end
  23.  
  24. function units_helicopter_alien_select()
  25.     units_select(12,1)
  26. end
  27.  
  28. function units_helicopter_alien_unselect()
  29.     units_unselect()
  30. end
  31.  
  32. function units_helicopter_alien_selectenemy()
  33.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  34. end
  35.  
  36. function units_helicopter_alien_damaged()
  37.     uniGetExecutor():applyDamage(uniGetLife())
  38. end
  39.  
  40. function units_helicopter_alien_highlight()
  41.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  42. end
  43.  
  44. function units_helicopter_alien_explode()
  45.     uniGetExecutor():getBone(ENBT_FAN,1):findEffect(ENET_EFFECT_BINDEDSPRITE_HELICOPTERALIENPROPELLER):destroy()
  46.     units_explode_fire()
  47. end
  48.  
  49. function units_helicopter_alien_fire()
  50. end
  51.  
  52. function units_helicopter_alien_move()
  53.     local unit = uniGetExecutor()
  54.     local mover = unit:helicopterMover()
  55.     if (mover ~= false) then waitDeath(mover) end
  56. --    local sound = unit:play3DSound("chopper.wav",1)
  57. --waitDeath(unit:helicopterFly(uniGetPosition()))
  58.     unit:helicopterFly(uniGetPosition())
  59. --    sound:destroy()
  60. end
  61.  
  62. function units_helicopter_alien_load()
  63.     local unit = uniGetExecutor()
  64.     local cargo = uniGetTarget()
  65.     units_waitCommandByUID(cargo,unit:getCurrentCommandUID() - 1)
  66.     unit:play3DSound("chopper fade.wav",0)
  67.     local hPos = unit:getHelicopterTarget()
  68.     waitDeath(unit:helicopterFly(cargo:getWorldPosition()))
  69.     unit:play3DSound("dragon load.wav",0)
  70.     uniSetPosition(unit:getBone(ENBT_FIRE1):getWorldPosition())
  71. --    local sound = unit:play3DSound("chopper.wav",1)
  72.     cargo:setTransformOwner(units_findfreefirespot(unit,1))
  73.     cargo:setVisibility(true,true)
  74.     cargo:setLocalPosition(0,0,0)
  75.     cargo:setLocalOrientation(0,1,0,0,0,1)
  76.     unit:helicopterFly(hPos) 
  77. --    waitDeath(unit:helicopterFly(hPos))
  78. --    sound:destroy()
  79.     cargo:terminateCommand()
  80. end
  81.  
  82. function units_helicopter_alien_unload()
  83.     local unit = uniGetExecutor()
  84.     local cargo = uniGetTarget()
  85.     units_waitCommandByUID(cargo,unit:getCurrentCommandUID() - 1)
  86.     local hPos = unit:getHelicopterTarget()
  87.     unit:play3DSound("chopper fade.wav",0)
  88.     waitDeath(unit:helicopterFly(uniGetPosition()))
  89.     unit:play3DSound("dragon load.wav",0)
  90.     cargo:setTransformOwner()
  91. --    local sound = unit:play3DSound("chopper.wav",1)
  92.     unit:helicopterFly(hPos)
  93. --    sound:destroy()
  94.     cargo:terminateCommand()
  95. end
  96.  
  97. function units_helicopter_alien_transfer()
  98.     local unit = uniGetExecutor()
  99.     local cargo = uniGetTarget()
  100.     units_waitCommandByUID(cargo,unit:getCurrentCommandUID() - 1)
  101.     local from = cargo:getTransformOwner():getTransformOwner()
  102.     local fromType = from:getEffectType()
  103.     units_waitCommandByUID(from,unit:getCurrentCommandUID() - 2)    
  104.     if(fromType == ENET_UNIT_HELICOPTER_ALIEN) then
  105.         waitDeath(from:parabolicTargetting(unit))
  106.         cargo:setTransformOwner()
  107.         units_helicopter_alien_load()
  108.         from:setCurrentAnimationRepeatCount(0)
  109.         from:terminateCommand()
  110.     elseif(fromType == ENET_UNIT_LANDTRANSPORT_ALIEN or fromType == ENET_UNIT_SEATRANSPORT_ALIEN) then
  111.         waitDeath(from:parabolicTargetting(unit))
  112.         cargo:setTransformOwner()
  113.         from:addAnimationToQueue(ENAT_PREPAREFORFIRE1,1)
  114.         from:addAnimationToQueue(ENAT_FIREPOSITION1,MATH_INFINITY)
  115.         from:addAnimationToQueue(ENAT_AFTERFIRE1,1)
  116.         units_unload_growth(cargo)
  117.         cargo:setTransformOwner()
  118.         cargo:setVisibility(true,false)
  119.         units_helicopter_alien_load()
  120.         from:setCurrentAnimationRepeatCount(0)
  121.         from:terminateCommand()
  122.     else
  123.         consoleWrite("attempt to reload from unknown transport type!!!")
  124.     end
  125. end
  126.  
  127. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_MOVE,"units_helicopter_alien_move")
  128. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_FIRE1,"units_helicopter_alien_fire")
  129. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_FIRE2,"units_helicopter_alien_fire")
  130. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_SELECT,"units_helicopter_alien_select")
  131. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_SELECTENEMY,"units_helicopter_alien_selectenemy")
  132. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_UNSELECT,"units_helicopter_alien_unselect")
  133. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_SETUP,"units_helicopter_alien_setup")
  134. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_RESETUP,"units_helicopter_alien_resetup")
  135. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_DAMAGED,"units_helicopter_alien_damaged")
  136. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_EXPLODE,"units_helicopter_alien_explode")
  137. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_HIGHLIGHT,"units_helicopter_alien_highlight")
  138. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_LOAD,"units_helicopter_alien_load")
  139. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_UNLOAD,"units_helicopter_alien_unload")
  140. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_TRANSFER,"units_helicopter_alien_transfer")
  141. registerCommand(ENSCRIPTSET_HELICOPTER_ALIEN,ENC_INSIDE,"units_inside")
  142.  
  143. -- make description of unit
  144. desc = getEffectDescriptionP(ENET_UNIT_HELICOPTER_ALIEN)
  145. desc.ClassID = ENCLASS_MESHINSTANCE
  146. desc.EffectClassType = ENECT_GEOMETRY
  147. desc.FileName = "helicopter_alien.rmd"
  148. desc.ScriptSet = ENSCRIPTSET_HELICOPTER_ALIEN
  149. desc.MoveType = ENMOVE_FLYCONSTANTHEIGHT
  150. --desc.MoveType = ENMOVE_GROUND
  151. desc.RenderType = ENRENDERTYPE_GEOMETRY
  152. desc.Material = ENMAT_RIGIDSKINNEDMESH
  153. desc.MaterialColors = units_materialcolors_human
  154. desc.isPlacesVisible = true
  155.  
  156. -- shadow
  157. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_HELICOPTERALIENSHADOW)
  158. desc.ClassID = ENCLASS_MESHINSTANCE
  159. desc.EffectClassType = ENECT_GEOMETRY
  160. desc.FileName = "helicopter_alien.rmd"
  161. desc.RenderType = ENRENDERTYPE_SHADOW
  162. desc.Material = ENMAT_SHADOW
  163. desc.MaterialColors = units_materialcolors_shadow
  164.  
  165. -- register new unit to logic
  166. unitDesc = logic_getUnitDescP(29)
  167. unitDesc.group = 2
  168. unitDesc.order = 2
  169. unitDesc.unit_res_id = ENET_UNIT_HELICOPTER_ALIEN
  170. unitDesc.unit_icon_id = "Helicopter_a_small_normal.dds"
  171. unitDesc.active_id = "Helicopter_a_small_active.dds"
  172. unitDesc.pressed_id = "Helicopter_a_small_pressed.dds"
  173. unitDesc.big_icon_id = "Helicopter_a_big_normal.dds"
  174. unitDesc.small_icon_id = "Dragonfly_l_stats.dds"
  175. unitDesc.HP = 3
  176. unitDesc.MP = 40
  177. unitDesc.WR = 0
  178. unitDesc.min_WR = 0
  179. unitDesc.WD = 0
  180. unitDesc.WR2 = 0
  181. unitDesc.min_WR2 = 0
  182. unitDesc.WD2 = 0
  183. unitDesc.ability = 6
  184. unitDesc.transport = 1
  185. unitDesc.value = 2
  186. unitDesc.race = 1
  187. unitDesc.fire_pause = 0.6
  188. unitDesc.move_pause = 0.5
  189. unitDesc.unit_info_scale = 0.07
  190. unitDesc.scn_name = "TRANSPCHOPPER"
  191.